//gridpanel操作按钮
function operatorBtn(value,cellmeta,record,rowIndex,columnIndex,store){
			var s1 = "<input type='button' value='修改' class='x-btn' onclick='edit("+rowIndex+")' />";
		    return s1;
}


//配置列模型gridPanel
var columns = new Ext.grid.ColumnModel([
	{header:'id',dataIndex:'id',width:70,sortable: true},
	{header:'名称',dataIndex:'name',width:80,sortable: true},  
	{header:'操作',dataIndex:'operate',width:160,renderer:operatorBtn}   
]);
//支持内存排序
columns.defaultSortable = true;

var stores =  new Ext.data.JsonStore({
  url:'../../paging.do',
  root:'rows.cell',
  fields:[  
  	{name :'id',mapping :'id',type :'string'},
  	{name :'name',mapping :'name',type :'string'}
  ],
  listeners:{load : 
	 function(store, records, options){ 
      	if(records.length==0){
	         store.loadData({'rows':[{'cell':{'id':'无对应批号'}}]}) 
      	}
	 }  
  }  
});

//gridPanel
var grid = new Ext.grid.GridPanel({
	cm:columns,
   	store:stores,
	autoHeight:true,
	stripeRows:true,
   	viewConfig:{forceFit:true},
   	loadMask:true,
   	tbar:[{text:'新增',iconCls:'add',handler:showInputWin}],
	bbar:new Ext.PagingToolbar({pageSize:2,store:stores,displayInfo:true,displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条'})
});